<?php 

$countries = array(	'spain',
					'france',
					'germany',
					'ireland',
					'northernIreland',
					'iceland',
					'uk',
					'faroeIslands',
					'portugal',
					'spain',
					'france',
					'italy',
					'switzerland',
					'germany',
					'denmark',
					'austria',
					'slovenia',
					'croatia',
					'montenegro',
					'albania',
					'greece',
					'westTurkey',
					'macedonia',
					'bulgaria',
					'bosniaAndHerzegovina',
					'serbia',
					'romania',
					'moldova',
					'ukraine',
					'westKazakhstan',
					'westRussia',
					'belarus',
					'hungary',
					'slovakia',
					'czechRepublic',
					'luxembourg',
					'belgium',
					'netherlands',
					'poland',
					'lithuania',
					'latvia',
					'estonia',
					'norway',
					'sweden',
					'finland',
					'svalbard'
					);


$__contents = 'package org.dschini.data.ui.maps.world.##Continent## {
	
	import org.dschini.utils.*;
	import org.dschini.data.ui.maps.*;
	import org.dschini.data.ui.maps.world.##Continent##.*;
	
	public class ##Country##MapData extends MapData
	{
		public function ##Country##MapData():void
		{
			_title = "<undefined>";
			backgroundVisible = false;
			stateLinesVisible = false;
			shapeVisible = true;
			locationData = new ExtendedArray();
		}
		
		override public function set lang( lang:String ):void
		{
			_lang = lang;
			switch( _lang ){
				case "en":
					_title = "##Country##";
					break;
				case "de":
					_title = "##Country##";
					break;
			}
			for(var i:int=0; i<locationData.length; i++){
				MapLocationData(locationData[i]).lang = lang;
			}
		}
	}
}';

$Continent = "europe";

foreach( $countries as $country ){
	$FileName = ucfirst($country).'MapData.as';

	if( file_exists( $FileName ) == false ){
		$fp = fopen($FileName, 'w');
		
		$healthy = array("##Continent##", "##Country##", "##CountryToLower##");
		$yummy = array($Continent,ucfirst($country),$country);
		$Contents = str_replace($healthy, $yummy, $__contents);
		
		fwrite($fp, $Contents);
		fclose($fp);
	}

}
